package com.youxue.dao;

import com.youxue.entity.Class;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ClassMapper {
    int deleteByPrimaryKey(Integer classId);

    int insert(Class record);

    int insertSelective(Class record);

    Class selectByPrimaryKey(Integer classId);

    int updateByPrimaryKeySelective(Class record);

    int updateByPrimaryKey(Class record);

    List<Class> selectATypeAllClassByPage(@Param(value = "startPos") Integer startPos, @Param(value = "pageSize") Integer pageSize, @Param(value = "classTypeId") Integer classTypeId);

    int selectAClassTypeCount(@Param(value = "classTypeId") Integer classTypeId);

    List<Class> selectListClassByKeyWord(@Param(value = "keyword") String keyword, @Param(value = "startPos") Integer startPos, @Param(value = "pageSize") Integer pageSize);

    int selectListClassCountByKeyWord(@Param(value = "keyword") String keyword);

    List<Class> selectListClassCountMore(@Param(value = "num") Integer num);

    List<Class> selectListClassByTime(@Param(value = "num") Integer num);

    int updateAClassCount(Integer classId);

    int selectMostStudyClassNum();
   List<Class> selectMostStudyClassByPage(@Param(value = "startNum") Integer startNum, @Param(value = "offSetNum") Integer offSetNum);
   List<Class> selectOrderClassTimeByPage(@Param(value = "startNum") Integer startNum, @Param(value = "offSetNum") Integer offSetNum);
   List<Class> selectOrderClassPersonByPage(@Param(value = "startNum") Integer startNum, @Param(value = "offSetNum") Integer offSetNum);
    int updateAClassScore(@Param(value = "classId") Integer classId, @Param(value = "score") Double score);

    //后台

    /**
     * 查询课程信息列表
     *
     * @return
     */
    List<Class> selectListClass(@Param(value = "pageOffset") Integer pageOffset,

                                @Param(value = "pageSize") Integer pageSize);

    /**
     * 查询课程总数
     *
     * @return
     */
    int selectClassTotal();

    /**
     * 查询一门课程详情
     *
     * @param classId
     * @return
     */
    Class selectAClass(Integer classId);

    /**
     * 通过关键字查询课程总数
     * @param keyword
     * @return
     */
    int selectClassTotalByKeyword(@Param(value = "keyword") String keyword);

    /**
     * 通过关键字查询课程（分页）
     * @param keyword
     * @param pageOffset
     * @param pageSize
     * @return
     */
    List<Class> selectListClassByKeyword(@Param(value = "keyword") String keyword,
                                         @Param(value = "pageOffset") Integer pageOffset,
                                         @Param(value = "pageSize") Integer pageSize);
}